$(function() {
	var contextPath = $("#contextPath").val();
	var recommended_head = $("#recommended_head");
	var recommended_middle = $("#recommended_middle");
	var two_dimension_code = $("#two_dimension_code");
	dataInit();

function dataInit(){
	
	$.ajax({
		url:"getRecommended",
		type:"post",
		async:true,
		dataType:"json",
		success : function(data, textStatus) {
			var state = data.result.state;
			if(state == 1){
				$.each(data.rHeadList,function(i,v){
					recommended_head.append('<div class="swiper-slide"><a href="#"><img src="'+contextPath+'/static/images/material_banner_01.png" width="100%" alt=""></a></div>');
				});
				
				$.each(data.rMiddleList,function(i,v){
					recommended_middle.append('<div class="swiper-slide scroll__item"><a href="#"><span class="commodity__img"><img src="${pageContext.request.contextPath}/static/images/material_commodity_01.png"></span><p class="commodity__txt">自然之宝关 Osteo 国原装氨糖软骨素</p></a><div class="commodity__live dt f0"><span class="dib vm commodity__live_price">&yen;1820</span><span class="dib vm commodity__live_marketprice">市价1820</span><span class="dib vm commodity__live_buy icon_car"></span></div></div>');
				});
			}
			
		},
		error : function(XMLHttpRequest, textStatus, errorThrown){
			layer.open({
			    content:textStatus,
			    time: 2
			});
		}
	});		
}



});